package com.bluedot.bank.action;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.bluedot.bank.dao.privilege.Privilege;
import com.bluedot.bank.dao.user.User;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AccountFilterAction extends ActionSupport {/**
														 * 
														 */
	private static final long serialVersionUID = 1L;
	private List<Filters> filters=new ArrayList<Filters>();
	{
		filters.add(new Filters(1,"全部"));
		filters.add(new Filters(2,"帐户ID"));
		filters.add(new Filters(3,"客户ID"));
		filters.add(new Filters(4,"账户类型"));
		filters.add(new Filters(5,"描述"));
		
	}
	/**
	 * @return the filters
	 */
	public List<Filters> getFilters() {
		return filters;
	}
	/**
	 * @param filters
	 *            the filters to set
	 */
	public void setFilters(List<Filters> filters) {
		this.filters = filters;
	}
	@Override
	public String execute() throws Exception {
		Map session=ActionContext.getContext().getSession();
		User user=(User)session.get("user");
		Set<Privilege> set=user.getRole().getPrivileges();
		Iterator<Privilege> iterator=set.iterator();
		while(iterator.hasNext()){
			if("帐户管理".equals(iterator.next().getPrivilegeName()))
				return SUCCESS;
		}
		return "noPrivilege";
		
	}

}
